<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM</title>
</head>
<body>
    <div id="ide">这是一个id选择器标签</div>
    <div class="class">这是一个class选择器标签</div>
    <div>这是一个div标签</div>
    <button onclick="myclick()">按一下吧</button>

    <button id="domb">不一样的按钮</button>


    <script>
        let idresult=document.getElementById('ide');
        let classresult=document.getElementsByClassName('class');
        let divresult=document.getElementsByTagName('div');
         console.log(idresult);
         console.log(classresult);
         console.log(divresult);
         idresult.style.color='red';
         idresult.style.fontSize='20px';

         function myclick(){
            alert('please leave now if your age is younger than 18!');
         }

         let buttonid=document.getElementById('domb');
         buttonid.onclick=function(){
            alert('this button is controled by dom');
         }

    </script>



</body>
</html>